
const Sequelize = require('sequelize');

module.exports = (sequelize, DataTypes) => {
  const User = sequelize.define('User', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: '主键'
    },
    mobile: {
      type: DataTypes.BIGINT(11),
      unique: true,
      comment: '手机号'
    },
    password: {
      type: DataTypes.STRING(50),
      comment: '密码（加密）'
    },
    username: {
      type: DataTypes.STRING,
      comment: '用户名',
      allowNull: true
    },
    createTime: {
      type: DataTypes.DATE,
      defaultValue: Sequelize.literal('NOW()'),
      comment: '创建时间'
    }
  }, {
    timestamps: false
  });

  return User
}